package mvn21.model;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class User {
	@Value("${myuser.name}")
	private String username;
	@Autowired    //按照类型进行注入
	@Qualifier("annoteAddress")   //按照名字进行注入
	private Address address;
	
	public User() {}
	
	public User(String m_username,Address m_address) {
		this.username = m_username;
		this.address = m_address;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	
	public void showInfo() {
		System.out.println("Username："+this.username);
		System.out.println("address："+this.address.getInfo());
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

}
